package com.netease.xone.itemview;

import protocol.meta.Subject;
import android.content.Context;
import android.database.Cursor;
import android.util.AttributeSet;
import android.view.View;

import com.google.gson.Gson;
import com.netease.image.ImageType;

import db.manager.ManagerDiscussTip;


public class ItemViewTipSubject extends ItemViewTipBase {

    public ItemViewTipSubject(Context context, int type) {
        super(context, type);
    }

    public ItemViewTipSubject(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ItemViewTipSubject(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void bindView(Cursor cursor) {
        String value = cursor.getString(ManagerDiscussTip.JSON);
        Gson gson = new Gson();
        Subject subject =gson.fromJson(value, Subject.class);
        mCheckBox.setVisibility(View.GONE);
        mContent.setVisibility(View.GONE);
        mIcon.setLoadingImage(subject.avatar, ImageType.CircleMemCache);
        mTitle.setText(subject.subjectName);
    }
}
